import fetch from 'common/src/utils/fetch';
import baseUrl from './env';
import UTILS from "common/src/utils/utils";
import {
  param
} from 'common/src/utils';
import axios from 'axios';
const BASER_SERV_URL = '/api/baseresservice';


// 获取学生信息
function studentDetail(data) {
  return fetch({
    url: `${baseUrl}/pgOverseasExchangeApply/studentDetail?studentId=`+data,
    method: 'Post',
    data
  });
}

// 学生申请列表
function listApply(data) {
  return fetch({
    url: `${baseUrl}/interschoolStudentApply/listApply`,
    method: 'Post',
    data
  });
}

// 学生申请撤销
function recallApply(data) {
  return fetch({
    url: `${baseUrl}/interschoolStudentApply/recallApply`,
    method: 'Post',
    data
  });
}

// 学生申请详情信息
function detailApply(data) {
  return fetch({
    url: `${baseUrl}/interschoolStudentApply/detailApply`,
    method: 'Post',
    data
  });
}

// 学术申请项目名称列表
function projectList(data) {
  return fetch({
    url: `${baseUrl}/interschoolStudentApply/projectList`,
    method: 'Post',
    data
  });
}

// 学生申请保存或提交
function studentApply(data) {
  return fetch({
    url: `${baseUrl}/interschoolStudentApply/studentApply`,
    method: 'Post',
    data
  });
}

// 学生编辑保存或提交
function editApply(data) {
  return fetch({
    url: `${baseUrl}/interschoolStudentApply/editApply`,
    method: 'Post',
    data
  });
}

// 学生申请删除
function deleteApply(data) {
  return fetch({
    url: `${baseUrl}/interschoolStudentApply/deleteApply`,
    method: 'Post',
    data
  });
}

// 学生申请审核列表
function listApprove(data) {
  return fetch({
    url: `${baseUrl}/interschoolStudentApply/listApprove`,
    method: 'Post',
    data
  });
}

// 学生申请通过、驳回、不通过
function approveApply(data) {
  return fetch({
    url: `${baseUrl}/interschoolStudentApply/approveApply`,
    method: 'Post',
    data
  });
}

// 学生申请审核导出
function exportApprove(data) {
  return fetch({
    url: `${baseUrl}/interschoolStudentApply/exportApprove`,
    method: 'Post',
    data
  });
}

  // 导出2
  function exportExcelS(data) {
    return fetch({
      url: `${baseUrl}/export/result/`+data,
      method: 'get',
      data
    }) 
  }
  
  // 导出3
  function exportExcelT(data) {
    return fetch({
      url: `${baseUrl}/export/file/?path=`+data,
      method: 'get',
      data,
      responseType: 'blob'
    }).then(res => {
      UTILS.downloadFile(res, '统计分析.xls', 'application/vnd.ms-excel;charset=utf-8');
  
    });
  }

export default {
  'studentDetail': studentDetail,
  'listApply': listApply,
  'recallApply': recallApply,
  'detailApply': detailApply,
  'projectList': projectList,
  'studentApply': studentApply,
  'editApply': editApply,
  'deleteApply': deleteApply,
  'listApprove': listApprove,
  'approveApply': approveApply,
  'exportApprove': exportApprove,
  'exportExcelS': exportExcelS,
  'exportExcelT': exportExcelT
};
